//------------------------------------------------------------------------------
// Copyright (c) 2008 www.dnaide.com
// Licensed under the MIT (MIT-LICENSE.txt)
//------------------------------------------------------------------------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using DNAide.Core;

namespace DNAide.Configuration
{
	/// <summary>
	/// DNAide configuration settings i.e. as configured in your web.config
	/// <example>
	/// <code>
	/// <configuration>
	///		<configSections>
	///			<sectionGroup name="dnAide">
	///				<section name="web" type="DNAide.Configuration.WebConfig" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
	///			</sectionGroup>
	///		</configSections>
	/// </configuration>
	/// <dnAide>
	///		<web>
	///			<urlRewriter defaultPage="index.htm">	
	///				<rules>
	///					<add id="news" matchExpression="~/news/(.*)/(.*).htm" destination="~/_Templates/WebForms/News.aspx?id=$1" />
	///				</rules>
	///			</urlRewriter>
	///			<httpErrorModule enabled="false">
	///				<rules>
	///					<add code="404" handlerPage="~/error404.aspx" />
	///					<add code="500" handlerPage="~/error500.aspx" />
	///				</rules>
	///			</httpErrorModule>
	///		</web>
	/// </dnAide>
	/// </code>
	/// </example>
	/// </summary>
	public static partial class DNAideConfigurationSettings
	{

		#region Static Attributes

		static private object _lock = new object();
		private static WebConfig _web;

		#endregion

		#region Static Properties

		/// <summary>
		/// Website config settings
		/// </summary>
		public static WebConfig Web
		{
			get
			{
				if (_web == null)
				{
					lock (_lock)
					{
						if (_web == null)
						{
							_web = (WebConfig)System.Configuration.ConfigurationManager.GetSection("dnAide/web");
						}
					}
				}
				return _web;
			}
		}

		#endregion

	}
}

